<?php

/**
 * Admin模块路由
 */
Route::group(['namespace' => '\App\Module\Admin\Controllers', 'prefix' => 'admin'], function () {
    /**
     * 在 "\App\Module\Admin\Controllers" 命名空间下的控制器
     * 需要登录的和不需要登录的区分
     * 根据大模块设置路由组
     * 注意：后台路由在设置时，必须指定路由名，例如：'admin.index.index'--模块名.控制器名.方法名
     */

    //管理员登录
    Route::get('/platform/login', 'PlatformController@login')->name('admin.platform.login');
    //管理员退出登陆
    Route::get('/platform/laout', 'PlatformController@laout')->name('admin.platform.laout');
    //ajax用户登陆
    Route::post('/platform/ajaxlogin', 'PlatformController@ajaxlogin')->name('admin.platform.ajaxlogin');

    Route::get('/platform/forgetPassword', 'PlatformController@forgetPassword')->name('admin.platform.forgetPassword');

    Route::get('/index/noAuth', 'IndexController@noAuth')->name('admin.index.noAuth');
    //定时任务更新用户等级
    Route::get('/member/apiupdatelv', 'MemberController@apiUpdateLv')->name('admin.member.apiupdatelv');

    /*
     * 验证码
     */
    Route::group([], function () {
        Route::get('/code/{tmp}', 'CodeController@captcha')->name('admin.code.captcha');
        Route::get('/member/generationRecord','MemberController@generationRecord')->name('admin.member.generationRecord');
        Route::get('/member/payWages','MemberController@payWages')->name('admin.member.payWages');
    });

    Route::group(['middleware' => ['CheckLogin']], function () {//中间件验证登陆
        //数据统计
        Route::group([], function () {
            Route::get('/index', 'IndexController@index')->name('admin.index.index');
        });

        /**
         * 会员管理
         */
        Route::group([], function () {                //会员管理页面
            Route::get('/member', 'MemberController@index')->name('admin.member.index');
            //会员资金页面
            Route::get('/member/cash/{id?}', 'MemberController@cash')->name('admin.member.cash');
            //编辑资金页面
            Route::get('/member/editCash/{id?}', 'MemberController@editCash')->name('admin.member.editCash');
            //会员管理详情页面
            Route::get('/member/view/{id?}', 'MemberController@view')->name('admin.member.view');
            //报单管理列表
            Route::get('/member/memberList', 'MemberController@memberList')->name('admin.member.memberList');
            //新增报单
            Route::any('/member/addMember', 'MemberController@addMember')->name('admin.member.addMember');
            //查看报单
            Route::get('/member/viewMember', 'MemberController@viewMember')->name('admin.member.viewMember');
            //设置工资
            Route::any('/member/setWages', 'MemberController@setWages')->name('admin.member.setWages');
            //转账
            Route::any('/member/transferCoin/{id?}', 'MemberController@transferCoin')->name('admin.member.transferCoin');
            //推荐关系图
            Route::get('/member/recommend', 'MemberController@recommend')->name('admin.member.recommend');
            //接点关系图
            Route::get('/member/contact', 'MemberController@contact')->name('admin.member.contact');
            // 获取接点关系
            Route::post('/member/ajaxGetContact', 'MemberController@ajaxGetContact')->name('admin.member.ajaxGetContact');

            //会员管理导出用户
            Route::get('/member/export', 'MemberController@export')->name('admin.member.export');
            //ajax修改会员管理会员帐号状态
            Route::post('/member/changeUserStatus', 'MemberController@changeUserStatus')->name('admin.member.changeUserStatus');
            // 保存资金修改
            Route::post('/member/ajaxSaveEditCash', 'MemberController@ajaxSaveEditCash')->name('admin.member.ajaxSaveEditCash');
        });

        /**
         * 文章管理
         */
        Route::group([], function () {
            //文章管理
            Route::get('/article', 'ArticleController@index')->name('admin.article.index');
            //ajax保存文章
            Route::post('/article/ajaxSave', 'ArticleController@ajaxSave')->name('admin.article.ajaxSave');
        });


        /*
         * 商品管理
         */
        Route::group([], function () {
            //商品管理
            Route::get('/goods', 'GoodsController@index')->name('admin.goods.index');
            //新增商品
            Route::get('/goods/add', 'GoodsController@add')->name('admin.goods.add');
            //编辑商品
            Route::get('/goods/edit/{id?}', 'GoodsController@edit')->name('admin.goods.edit');
            //修改商品状态
            Route::post('/goods/ajaxChangeSt', 'GoodsController@ajaxChangeSt')->name('admin.goods.ajaxChangeSt');
            // 上传图片
            Route::post('/goods/uploadFiles', 'GoodsController@uploadFiles')->name('admin.goods.uploadFiles');
            // 保存商品信息
            Route::post('/goods/ajaxSave', 'GoodsController@ajaxSave')->name('admin.goods.ajaxSave');
        });

        /*
         * 订单管理
         */
        Route::group([], function () {
            //订单列表
            Route::get('/order', 'OrderController@index')->name('admin.order.index');
            //订单详情
            Route::get('/order/view/{id?}', 'OrderController@view')->name('admin.order.view');
            //下载订单列表
            Route::get('/order/downLoad', 'OrderController@downLoad')->name('admin.order.downLoad');
            //保存修改信息
            Route::post('/order/ajaxSave', 'OrderController@ajaxSave')->name('admin.order.ajaxSave');
        });

        /*
         * 财务管理
         */
        Route::group([], function () {
            //创客财务
            Route::get('/finance', 'FinanceController@index')->name('admin.finance.index');
            //下载财务列表
            Route::get('/finance/downList', 'FinanceController@downList')->name('admin.finance.downList');
            //创客提现
            Route::get('/finance/getCash', 'FinanceController@getCash')->name('admin.finance.getCash');
            //处理提现
            Route::post('/finance/ajaxCheckGetCash', 'FinanceController@ajaxCheckGetCash')->name('admin.finance.ajaxCheckGetCash');
            //充值记录
            Route::get('/finance/rechargeLog', 'FinanceController@rechargeLog')->name('admin.finance.rechargeLog');
            //下载充值记录
            Route::get('/finance/downRechargeLogList', 'FinanceController@downRechargeLogList')->name('admin.finance.downRechargeLogList');
            //待结算积分
            Route::get('/finance/integral', 'FinanceController@integral')->name('admin.finance.integral');
            //待结算注册币
            Route::get('/finance/registerCoin', 'FinanceController@registerCoin')->name('admin.finance.registerCoin');
            //待结算积分和注册币
            Route::post('/finance/ajaxInteCoin', 'FinanceController@ajaxInteCoin')->name('admin.finance.ajaxInteCoin');
            //导出待结算注册币和积分
            Route::get('/finance/downRegisterCoinList', 'FinanceController@downRegisterCoinList')->name('admin.finance.downRegisterCoinList');
            //兑换券消耗
            Route::get('/finance/voucher', 'FinanceController@voucher')->name('admin.finance.voucher');
        });

        /**
         * 平台管理
         */
        Route::group([], function () {
            //职务列表
            Route::get('/platform/position', 'PlatformController@position')->name('admin.platform.position');
            //新增职务
            Route::get('/platform/addPosition', 'PlatformController@addPosition')->name('admin.platform.addPosition');
            //编辑职务
            Route::get('/platform/editPosition/{id?}', 'PlatformController@editPosition')->name('admin.platform.editPosition');
            //ajax新增、编辑职务
            Route::post('/platform/ajaxEditPosition', 'PlatformController@ajaxEditPosition')->name('admin.platform.ajaxEditPosition');
            //ajax删除职务
            Route::post('/platform/ajaxDelPosition', 'PlatformController@ajaxDelPosition')->name('admin.platform.ajaxDelPosition');
            //管理员列表
            Route::get('/platform/admin', 'PlatformController@admin')->name('admin.platform.admin');
            //新增管理员
            Route::get('/platform/addAdmin', 'PlatformController@addAdmin')->name('admin.platform.addAdmin');
            //编辑管理员
            Route::get('/platform/editAdmin/{id?}', 'PlatformController@editAdmin')->name('admin.platform.editAdmin');
            //ajax新增编辑管理员
            Route::post('/platform/ajaxEditAdmin', 'PlatformController@ajaxEditAdmin')->name('admin.platform.ajaxEditAdmin');
            //启用、禁用管理员
            Route::post('/platform/ajaxChangeStatus', 'PlatformController@ajaxChangeStatus')->name('admin.platform.ajaxChangeStatus');
            //删除管理员
            Route::post('/platform/ajaxDelAdmin', 'PlatformController@ajaxDelAdmin')->name('admin.platform.ajaxDelAdmin');
            //获取职务权限模块
            Route::post('/platform/ajaxGetModules', 'PlatformController@ajaxGetModules')->name('admin.platform.ajaxGetModules');
            //复消日志
            Route::get('/platform/reSaleLog', 'PlatformController@reSaleLog')->name('admin.platform.reSaleLog');
            //管理员日志
            Route::get('/platform/adminLog', 'PlatformController@adminLog')->name('admin.platform.adminLog');
            //短信日志
            Route::get('/platform/messageLog', 'PlatformController@messageLog')->name('admin.platform.messageLog');
            //修改密码
            Route::get('/platform/changePassword', 'PlatformController@changePassword')->name('admin.platform.changePassword');
            //ajax修改密码
            Route::post('/platform/ajaxChangePwd', 'PlatformController@ajaxChangePwd')->name('admin.platform.ajaxChangePwd');
            Route::any('/platform/holiday', 'PlatformController@holiday')->name('admin.platform.holiday');//设置节假日
            Route::post('/platform/delHoliday', 'PlatformController@delHoliday')->name('admin.platform.delHoliday');//设置节假日
            Route::post('/platform/addHoliday', 'PlatformController@addHoliday')->name('admin.platform.addHoliday');//设置节假日
            //权限模块，用于开发人员调整
            Route::get('/platform/module', 'PlatformController@module')->name('admin.platform.module');
            Route::get('/platform/addModule', 'PlatformController@addModule')->name('admin.platform.addModule');
            Route::get('/platform/editModule/{id}', 'PlatformController@editModule')->name('admin.platform.editModule');
            Route::post('/platform/ajaxModule', 'PlatformController@ajaxModule')->name('admin.platform.ajaxModule');
            Route::post('/platform/delModule', 'PlatformController@delModule')->name('admin.platform.delModule');

        });

    });

});

